<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>修改密码-填写新密码</title>
<script type="text/javascript" language="javascript" th:src="@{/y9static/js/jquery/jquery-1.10.2.min.js}"></script>
<script type="text/javascript" language="javascript" th:src="@{/y9static/js/jquery/jquery.cookie.js}"></script>
<!-- <script type="text/javascript" src="${ctx}/static/js/jquery/login.js"></script> -->
<link type="text/css" rel="stylesheet"  th:href="@{/y9static/css/modifyPassword/modifyPassword.css}" />
<link type="text/css" rel="stylesheet"  th:href="@{/y9static/css/modifyPassword/resetPassword.css}" />
</head>
<body>
<h1><img th:src="@{/y9static/images/login/LOGO.png}"><sup><font color="white">密码修改</font></sup></h1>

<div class="login" style="margin-top:50px;">
    <div class="header">
        	<ul class="step-container">
				<li class="step-past">确认账号
		            <span class="arrow arrow-past">
		                <span class="arrow-pre"></span>
		                <span class="arrow-next"></span>
		            </span>
		        </li>
				<li class="step-current">安全认证
		            <span class="arrow arrow-current">
		                <span class="arrow-pre"></span>
		                <span class="arrow-next"></span>
		            </span>
		        </li>
				<li class="step-next">重置密码</li>
			</ul>
    </div>    
    <div class="web_qr_login" id="web_qr_login" style="display: block; height: 235px;">    
            <div class="web_login" id="web_login">
               <div class="login-box">
			<div class="login_form">
				<form id="myform" method="post">
	                <div class="uinArea" id="uinArea">
		                   	 <font color="red">*</font>新登录密码：
		                   	 <input type="password" name="newPassword" value="" id="newPassword"></input>
	                </div>
	                <div class="pwdArea" id="pwdArea">
		                    <font color="red">*</font>确认新密码：
		                    <input type="password" name="confirmPassword" value="" id="confirmPassword"></input>
							<input type="hidden" name="personID" th:value="${personID}" id="personID">
							<input type="hidden" name="tenantID" th:value="${tenantID}" id="tenantID">
	                </div>
                <div style="padding-left:50px;margin-top:20px;">
                		<input type="button" value="确定" onclick ="save();" style="width:150px;" class="button_blue"></input>
                </div>
              </form>
           </div>
            	</div>
            </div>
  </div>
</div>
<div class="jianyi">
	<span>版权所有 北京有生博大软件股份有限公司  建议IE9浏览器、1366*768分辨率及以上浏览器和分辨率浏览本网</span><br>
</div>
</body>
<script type="text/javascript">
		var ctx = "[(${#request.getContextPath()})]";
		function save(){
		   var newPassword = $("#newPassword").val();
		   var confirmPassword = $("#confirmPassword").val();
		   var personID = $("#personID").val();
		   var tenantID = $("#tenantID").val();
		   
		   if($.trim(newPassword).length<=0){
			   alert("新登录密码为空！");
		     return false;
		   }
		   
		   if($.trim(confirmPassword).length<=0){
			     alert("确认新密码为空！");
			     return false;
		   }
		   
		   if($.trim(newPassword).length<6){
			   alert("新登录密码长度必须大于等于6！");
		     return false;
		   }
		   
		   if($.trim(confirmPassword).length<6){
			     alert("确认新密码长度必须大于等于6！");
			     return false;
		   }
		   
		   if(newPassword!=confirmPassword){
			   alert("两次输入密码不相等！");
			     return false;
		   }
		   
		   $.ajax({
			     async:false,
			     cache: false,
		         type: "POST",
		         url: ctx+"/api/modifyPassword/savePassword",
		         data: {
		        	 newPassword:newPassword,
		        	 confirmPassword:confirmPassword,
		        	 personID:personID,
		        	 tenantID:tenantID},
		         dataType: "json",
		         success: function(data){
		              if(data.success){
		            	  alert("修改密码成功！");
		            	  window.close();
		              }else{
		            	  $("#newPassword").val("");
		       		   	  $("#confirmPassword").val("");
		            	  alert("修改密码失败！");
		              }
		        }
		});
		}
	</script>
</html>